<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>红包</title>
    <link rel="stylesheet" type="text/css" href="./css/api.css" />
    <link rel="stylesheet" type="text/css" href="./css/aui.css" />
    <link rel="stylesheet" type="text/css" href="./css/font-awesome.min.css" />
    <link rel="stylesheet" type="text/css" href="./css/style.css" />
    <script type="text/javascript" src="./script/api.js"></script>
    <script type="text/javascript" src="./script/aui-tab.js" ></script>
    <link rel="stylesheet" type="text/css" href="./css/aui-slide.css" />
    <script type="text/javascript" src="./script/aui-slide.js"></script>
    <script type="text/javascript">
        function closeThisWin(){
            var gotoUser = 'gotoUser();';
            api.execScript({
                name: 'home',
                script: gotoUser,
            });

            api.closeWin({
            });
        };
    </script>
</head>
<body>
 <!-- 头部 -->
 <header class="aui-bar aui-bar-nav pos">
    <a class="aui-pull-left aui-btn" onclick="closeThisWin()">
        <span class="aui-iconfont aui-icon-left"></span>
    </a>
    <div class="aui-title">红包</div>
</header>

<!-- 红包 -->
<style>
    body,html{height:100%; background:#e0041b;}
</style>
<div class="hongbao">
    <div class="hongbao-t-1"><span id="money_top">0</span>元红包</div>
    <div class="hongbao-m-1">
        <p>恭喜您成功领取<span id="money_bottom">0</span>元红包奖励</p>
    </div>
    <a class="hongbao-btn" onclick="openRedPacket()">查看红包</a>
    <div class="aui-clearfix"></div>
    <a class="hongbao-btn" onclick="openLicai()">立即投资</a>
</div>



</body>
<script type="text/javascript">

    apiready = function(){

        api.addEventListener({
            name: 'keyback'
        }, function(ret, err) {
            closeThisWin();
        });

        var money_top = document.getElementById("money_top");
        var money_bottom = document.getElementById("money_bottom");
        var param = api.pageParam;
        ecv_type_id = param.ecv_type_id;
        // alert(ecv_type_id);
        if (ecv_type_id == 9) {
            var money = 30;
            money_top.innerText = money;
            money_bottom.innerText = money;
        }else if(ecv_type_id == 297){
            var money = 50;
            money_top.innerText = money;
            money_bottom.innerText = money;
        }else if(ecv_type_id == 362){
            var money = 88;
            money_top.innerText = money;
            money_bottom.innerText = money;
        }else if(ecv_type_id == 363){
            var money = 188;
            money_top.innerText = money;
            money_bottom.innerText = money;
        }else{
            var money = 188;
            money_top.innerText = money;
            money_bottom.innerText = money;
        }
    }

    function openRedPacket(){
        api.openWin({
            name: 'red_packet_list',
            url: './red-packet-list.html',
            bounces: false,
            slidBackEnabled: true,
            vScrollBarEnabled: false,
            progress: {
                type: "page"
            }
        });
    }

    function openLicai(){
        // 上页面刷新数据
        var refreshLicai = 'gotoLicai();';
        api.execScript({
            name: 'home',
            script: refreshLicai,
        });

        // 成功后关闭登录页面
        api.closeToWin({
            name: 'home'
        });
    }
</script>
</html>
